﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CloseDisplay1
{
    internal class Program
    {
       static LockScreenIdleMonitor monitor = new LockScreenIdleMonitor();

        static void Main(string[] args)
        { 
            monitor.IdlTick += (s, sec) =>
            { 
                Console.WriteLine($"{DateTime.Now:HH:mm:ss}  键鼠闲置 {sec} 秒");
            };

            monitor.IdlHandle += (s, e) =>
            {
                Console.WriteLine($"{DateTime.Now:HH:mm:ss}  键鼠达到{monitor.Threshold}秒未操作\n");
                Tools.TurnOffMonitor();//关闭显示器
            };

            monitor.Threshold = 15;
            monitor.Start();
            while (true)
            {
                Task.Delay(100);
            }
        }
    }
}
